package com.hnas.trade.domain;

import java.util.HashMap;
import java.util.Map;

public enum PayStatus {
	Unpay("0","未支付"),
	Payed("1","支付成功"),
	PayFail("2","支付失败");
	
	private String status;
	private String description;
	
	private PayStatus(String status,String description){
		this.status = status;
		this.description = description;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public static PayStatus getStatus(String key) {
		for (PayStatus status : PayStatus.values()) {
			if (status.getStatus().equals(key)) {
				return status;
			}
		}
		return null;
	}
	
	public static String getPayStatusString(String key) {
		return getStatus(key) == null ? "" : getStatus(key)
				.getDescription();
	}
	
	public static Map<String, String> getPayStatusMap(){
		Map<String, String> map = new HashMap<String, String>();
		for (PayStatus status : PayStatus.values()) {
			map.put(status.getStatus(), status.getDescription());
		}
		return map;
	}
}
